package com.zctest.controller;

import com.zctest.entity.User;
import com.zctest.service.CommonService;
import com.zctest.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhangchao
 * @version 1.0
 * @date 2019/1/7
 */

@RestController
@RequestMapping("api")
public class TestController {

    @Autowired
    private UserService userService;
    @Autowired
    private CommonService commonService;

    @GetMapping
    @RequestMapping("a")
    public Object save(){

        userService.saveTogether(new User());
        return "ok";
    }
    @GetMapping
    @RequestMapping("b")
    public Object saveb(){

        commonService.save();
        return "ok";
    }
    @GetMapping
    @RequestMapping("c")
    public Object savec(){
        commonService.saveNotTransaction();
        return "ok";
    }
}
